package cn.cloud9;

public class Demo11String {

    /**
     * https://www.bilibili.com/video/BV18J411W7cE?p=123
     * 统计输入的字符串中, 大写字符个数,小写字符个数,数字字符个数
     * @param args
     */
    public static void main(String[] args) {
        int numberCount = 0;
        int upperCount = 0;
        int lowerCount = 0;

        String target = "asdj2354r378fbjsAFSADHJCXCK.,SAZXQWDQCsdxcqwswe4f";
        for (int i = 0; i < target.length(); i++) {
            char currentChar = target.charAt(i);
            if ('A' <= currentChar && currentChar <= 'Z') ++ upperCount;
            else if ('a' <= currentChar && currentChar <= 'z') ++ lowerCount;
            else if ('0' <= currentChar && currentChar <= '9') ++ numberCount;
        }
        System.out.printf("[A-Z]%d, [a-z]%d, [0-9]%d\n", upperCount, lowerCount, numberCount);
    }
}
